package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.bizsys.mapper.CrsUserLogMapper;
import com.ruoyi.bizsys.domain.CrsUserLog;
import com.ruoyi.bizsys.service.ICrsUserLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * crs_user 剔除记录Service业务层处理
 *
 * @author ygw
 * @date 2022-08-22
 */
@Service
public class CrsUserLogServiceImpl extends ServiceImpl<CrsUserLogMapper, CrsUserLog> implements ICrsUserLogService {

    /**
     * 查询crs_user 剔除记录
     *
     * @param id crs_user 剔除记录ID
     * @return crs_user 剔除记录
     */
    @Override
    public CrsUserLog selectCrsUserLogById(Integer id) {
        return this.getById(id);
    }

    /**
     * 查询crs_user 剔除记录列表
     *
     * @param crsUserLog crs_user 剔除记录
     * @return crs_user 剔除记录
     */
    @Override
    public List<CrsUserLog> selectCrsUserLogList(CrsUserLog crsUserLog) {
        return this.list(new QueryWrapper<>(crsUserLog).last("order by id desc"));
    }

    /**
     * 新增crs_user 剔除记录
     *
     * @param crsUserLog crs_user 剔除记录
     * @return 结果
     */
    @Override
    public int insertCrsUserLog(CrsUserLog crsUserLog) {
        crsUserLog.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insert(crsUserLog);
    }

    /**
     * 修改crs_user 剔除记录
     *
     * @param crsUserLog crs_user 剔除记录
     * @return 结果
     */
    @Override
    public int updateCrsUserLog(CrsUserLog crsUserLog) {
        crsUserLog.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateById(crsUserLog);
    }

    /**
     * 批量删除crs_user 剔除记录
     *
     * @param ids 需要删除的crs_user 剔除记录ID
     * @return 结果
     */
    @Override
    public int deleteCrsUserLogByIds(Integer[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除crs_user 剔除记录信息
     *
     * @param id crs_user 剔除记录ID
     * @return 结果
     */
    @Override
    public int deleteCrsUserLogById(Integer id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public int insertCrsUserLogList(List<CrsUserLog> crsUserLogList) {
        return baseMapper.insertCrsUserLogList(crsUserLogList);
    }

}
